<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Dettaglio news</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" />
<script type="text/javascript" src="../../js/prototype.js"></script>
<script type="text/javascript" src="../../js/scriptaculous.js"></script>
<script type="text/javascript" src="../../js/page.js"></script>
<script type="text/javaScript">
function add_teacher(nome, id){
	var doc = parent.win.getContent().contentDocument;
	var f1 = parent.frames[0];
	var l = "<a href='#' onclick='del("+id+")' id='al"+id+"'>"+nome+"</a>";
	if(doc.getElementById("figli").innerHTML != "")
		l = ", "+l;
	doc.getElementById("figli").innerHTML += l;
	f1.id_alunni[id] = nome;
	//alert("##"+window.opener.document.forms[0].id_figli.value+"###");
	if(doc.forms[0].id_figli.value != "")
		id = ","+id;
	doc.forms[0].id_figli.value += id;
	//alert(window.opener.document.forms[0].id_figli.value);
}

function go(){
	document.forms[0].action.value = "elenco_alunni.php";
	document.forms[0].submit();
}

</script>
<style type="text/css">
<!--
body {font-size: 9px}
TD {height: 15px}
-->
</style>
</head>
<body>
    <p class="popup_header">Seleziona i tuoi figli</p>
    <form>
    <div style="margin-right: auto; margin-left: auto; margin-top: 20px; width: 320px">
    	<table style="margin-right: auto; margin-left: auto; width: 300px">
    	<tr>
    		<td style="font-weight: bold; width: 150px">Classe</td>
    		<td colspan="2">
    			<select style="border: 1px solid; color: #777; font-size: 11px; width: 50px" onchange="go()" name="filtro_classe">
    				<option value="0">Seleziona</option>
    				<?php
					while($cls = $res_classi->fetch_assoc()){
						$a = $cls['anno_corso'].$cls['sezione'];
    				?>
    				<option <?php if($a == $_REQUEST['filtro_classe']) print("selected='selected'") ?> value="<?php print $a ?>"><?php print $a ?></option>
    				<?php
					}
    				?>
    			</select>
    		</td>
    		<td style="text-align: right">
    			<a href="#" onclick="parent._win.close()">Chiudi</a>
    		</td>
    	</tr>
    	<?php
    	$index = 1;
    	if(isset($res_docenti)){
	    	while($teacher = $res_docenti->fetch_assoc()){
	    		if($index == 1){
    	?>
    		<tr>
	            
    	<?php		
    			}
    	?>
	            <td colspan="2" style="width: 150px; padding-left: 5px; color: #003366; "><a href="#" onclick="add_teacher('<?php print $teacher['cognome']." ".$teacher['nome'] ?>', <?php print $teacher['id_alunno'] ?>)"><?php print $teacher['cognome']." ".$teacher['nome'] ?></a></td>
    	<?php
    			if(($index%2) == 0){
    	?>
	    	</tr>
	    	<tr>
	    <?php		
    			}  	
    			$index++;
    		}
    	}
    	?>
	        
	        </tr>
	        <tr>
	            <td colspan="4">&nbsp;&nbsp;&nbsp;</td>
	        </tr>
	    </table>
    </div>
    <div style="margin-top: 30px">
    <input type="hidden" name="funzione" />
    <input type="hidden" name="_i" />
    <input type="hidden" name="teachers" />
    </div>
    </form>
</body>
</html>